package com.peter.spring.demo.service.impl;

import com.peter.spring.demo.service.IModifyService;
import com.peter.spring.demo.service.IQueryService;
import com.peter.spring.framework.annotation.XDAutowired;
import com.peter.spring.framework.annotation.XDService;

/**
 * @Auther: 肖冬
 * @Date: 2020/7/20 21:08
 * @Description: 增删改业务
 */
@XDService
public class ModifyService implements IModifyService {

    @XDAutowired
    IQueryService iQueryService;

    /**
     * 增加
     * @param name
     * @param addr
     * @return
     * @throws Exception
     */
    @Override
    public String add(String name, String addr) throws Exception {
//        throw  new Exception("这是故意抛的异常！！");
        return String.format("modifyService add,name=%s,addr=%s",name,addr);
    }

    /**
     * 修改
     * @param id
     * @param name
     * @return
     */
    @Override
    public String edit(Integer id, String name) {
        return String.format("modifyService edit,id=%s,name=%s",id,name);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    public String remove(Integer id) {
        return String.format("modifyService remove,id=%s",id);
    }
}
